$.validator.setDefaults({
  submitHandler: function() {
    alert("提交事件!");
    window.location.href="success.html";
  }
});
$().ready(function() {
// 在键盘按下并释放及提交后验证提交表单
  $("#signupForm").validate({
    rules: {
      username: {
        required: true,
        isUsername:true
      },
      account:{
        required:true,
        minlength:2
      },
      password: {
        required: true,
        minlength: 10
      },
      password_confirmation: {
        required: true,
        minlength: 10,
        equalTo: "#password"
      },
      mail: {
        required: true,
        email: true
      },
      phone:{
        required:true,
        isPhone:true
      },
      idNo:{
        required:true,
        isIdNo:true,
      }
    },
    messages: {

      username: {
        required: "请输入用户名",
        isUsername: "账号必需由两个以上的中文组成"
      },
      account: {
        required: "请输入账号",
        minlength: "账号必需由两个字母组成"
      },
      password: {
        required: "请输入密码",
        minlength: "密码长度不能小于 10 个字母"
      },
      confirm_password: {
        required: "请输入密码",
        minlength: "密码长度不能小于 10 个字母",
        equalTo: "两次密码输入不一致"
      },
      email: "请输入一个正确的邮箱",
    }
  });
});